import {
    findInOrder,
} from '../../../../api/repository/in_aftersale.js'



let RepInAfterSale = {

    data() {
        return {
            //分页信息
            currentPage: 1,
            pageSize: 5,
            total: 0,

            //出库订单列表
            inOrderList: [],

            createTime: [],//时间

            //搜索列表
            search: {
                currentPage: 1,
                pageSize: 5,

                inorderCode: "",//出库订单编号
                status: "",//入库出库
                type: "",//订单类型  1：返厂维修出库
                startTime: "",
                endTime: "",
            },

            //展示信息
            dialogTableVisible: false,//模态框可见性
            details: {
                afterFormat: ""
            },
            goodList: []

        }
    },
    methods: {
        find(params) {
            let vm = this;
            if (params == null) {
                params = {
                    currentPage: vm.$data.currentPage,
                    pageSize: vm.$data.pageSize,
                }
            }
            findInOrder(params).then(value => {
                vm.inOrderList = value.records;
                vm.total = value.total;
            })
        },

        //每页条数变化
        handleSizeChange(pageSize) {
            this.pageSize = pageSize;
            this.search.currentPage = this.currentPage;
            this.search.pageSize = pageSize;
            this.find(this.search);
        },
        //页码改变
        handleCurrentChange(currentPage) {
            this.currentPage = currentPage;
            this.search.currentPage = currentPage;
            this.search.pageSize = this.pageSize;
            this.find(this.search);
        },

        //时间格式化
        creatFormatter(row) {
            if (row.createTime !== null) {
                return row.createTime.replace("T", " ");
            }
        },

        //制单日期
        chooseTime() {
            this.search.startTime = this.createTime[0];
            this.search.endTime = this.createTime[1];
        },

        //显示详情
        showInfo() {
        },

        //生成出库单
        generateBill() {
        },

        findPage() {
            this.find(this.search);
        },

        resetForm() {
            this.createTime = [];
            this.search = {
                currentPage: 1,
                pageSize: 5,

                itorderCode: "",//出库订单
                status: "",//入库出库
                type: "",//订单类型  1：返厂维修出库
                startTime: "",
                endTime: "",
            };
            this.find();
        },
    },
    created() {
        this.find();
    }
};

export default RepInAfterSale;